﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyCalendar.aspx.cs" Inherits="user_MyCalendar" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>My Calendar</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel runat="server" ID="uplViewType">
        <ContentTemplate>
            <asp:RadioButtonList Visible="false" CssClass="sTable" AutoPostBack="true" runat="server"
                RepeatDirection="Horizontal" ID="rdoViewType" OnSelectedIndexChanged="rdoViewType_SelectedIndexChanged">
                <asp:ListItem Text="Month" Value="1" />
                <asp:ListItem Text="Week" Value="2" />
                <asp:ListItem Text="Today" Value="3" />
                <asp:ListItem Text="4 Days" Value="4" />
            </asp:RadioButtonList>
            <br />
            <table width="100%">
                <tr>
                    <td align="center">
                        <asp:Label runat="server" ID="lblViewType" Text="View Type" Font-Bold="true" />
                        <asp:DropDownList ID="ddlViewType" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlViewType_SelectedIndexChanged">
                            <asp:ListItem Text="Month" Value="1" />
                            <asp:ListItem Text="Week" Value="2" />
                            <asp:ListItem Text="Today" Value="3" />
                            <asp:ListItem Text="Four Day" Value="4" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td valign="middle" align="center">
                        <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Gray"
                            ShowGridLines="true" BorderWidth="1px" Font-Size="10pt" ForeColor="Black" Height="400px"
                            NextPrevFormat="FullMonth" OnDayRender="Calendar1_DayRender" OnSelectionChanged="Calendar1_SelectionChanged"
                            OnVisibleMonthChanged="Calendar1_VisibleMonthChanged" Width="800px" SelectionMode="None">
                            <SelectedDayStyle BackColor="#333399" ForeColor="White" />
                            <TodayDayStyle BackColor="#ffffcc" />
                            <OtherMonthDayStyle ForeColor="#999999" />
                            <WeekendDayStyle BackColor="#f7f7f7" />
                            <NextPrevStyle Font-Bold="True" Font-Size="8pt" Font-Underline="true" ForeColor="#333333"
                                VerticalAlign="Bottom" />
                            <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
                            <TitleStyle BackColor="White" Font-Bold="True" Font-Size="14pt" ForeColor="#333399" />
                        </asp:Calendar>
                        <asp:GridView ID="GridView1" Visible="False" runat="server" Font-Size="Medium" CellPadding="2"
                            ForeColor="#333333" GridLines="None" Width="850px" Height="400px" OnRowDataBound="GridView1_RowDataBound">
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <HeaderStyle BackColor="#5D7B9D" Font-Size="Small" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#999999" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:GridView>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>

    <script type="text/javascript">
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);
        var postBackElement;
        function InitializeRequest(sender, args) {
            if (prm.get_isInAsyncPostBack())
                args.set_cancel(true);
            postBackElement = args.get_postBackElement();
            OnOffUpdateProgress(true);
        }


        function OnOffUpdateProgress(onOff) {
            if ($get('<%=ddlViewType.ClientID%>') != null) {
                $get('<%=ddlViewType.ClientID%>').disabled = onOff;
            }
        }

        function EndRequest(sender, args) {
            OnOffUpdateProgress(false);
        }
        
    </script>

</body>
</html>
